"""
大屏登录页
"""
from common.base import create_browser, Base

class PageLogin(Base):
    """类属性：页面元素定位器"""
    url = "https://cdszhmz.com/kshDp/loginpath"
    username = ('id', 'userName') # 账号输入框
    password = ('id', 'password') # 密码输入框
    login = ('xpath', '//*[@id="root"]/div/div/div/div/form/div[3]/button') # 登录按钮

    """类方法:元素操作方法"""

    def Login_OpenWeb(self):
        """
        打开大屏登录页
        :return:
        """
        self.base_OpenWeb(self.url)

    def Login_username(self, username):
        """
        输入用户名
        :param username: 账号
        :return:
        """
        self.base_SendWords(self.username, username)

    def Login_password(self, password):
        """
        输入密码
        :param password:
        :return:
        """
        self.base_SendWords(self.password, password)

    def Login_Login(self):
        """
        点击登录按钮
        :return:
        """
        self.base_click(self.login)

if __name__ == '__main__':
    browser = create_browser()
    L = PageLogin(browser)
    L.Login_OpenWeb()
    L.Login_username('smj')
    L.Login_password('123456Xie')
    L.Login_Login()